<template>
  <view class="help-bg">
    <!-- 顶部栏 -->
    <view class="help-header">
      <uni-icons type="left" size="24" @click="goBack" style="color: white;margin-right: 10px"/>
      <view class="help-title">应急救援</view>
    </view>

    <!-- 地图卡片 -->
    <view class="help-map-card">
      <map style="width: 100%;height: 200px"></map>
    </view>

    <!-- tab 切换 -->
    <view class="help-tabs">
      <view :class="['help-tab', tabIndex === 0 ? 'active' : '']" @click="tabIndex = 0">搭电</view>
      <view :class="['help-tab', tabIndex === 1 ? 'active' : '']" @click="tabIndex = 1">换胎</view>
      <view :class="['help-tab', tabIndex === 2 ? 'active' : '']" @click="tabIndex = 2">拖车</view>
    </view>

    <!-- 拖车表单 -->
    <view class="help-form-card">
      <view class="help-form-row">
        <input class="help-input" placeholder="起点" v-model="form.start" />
      </view>
      <view class="help-form-row">
        <input class="help-input" placeholder="终点" v-model="form.end" />
      </view>
      <view class="help-form-row">
        <input class="help-input" placeholder="求助人" v-model="form.name" />
      </view>
      <view class="help-form-row">
        <input class="help-input" placeholder="联系方式" v-model="form.phone" />
      </view>
      <view class="help-form-row">
        <input class="help-input" placeholder="车牌" v-model="form.plate" />
      </view>
      <view class="help-form-row">
        <textarea class="help-textarea" placeholder="描述" v-model="form.desc" />
      </view>
      <button class="help-btn" @click="callHelp">呼叫救援</button>
      <view class="help-tip">救援进度 ></view>
    </view>

    <!-- 警务救助 -->
    <view class="help-police-card">
      <view class="help-police-title">警务救助</view>
      <view class="help-police-list">
        <view class="help-police-item">
          <image src="/static/yyq/police_jt.png" class="help-police-icon" />
          <view class="help-police-label">交通事故</view>
          <view class="help-police-num">122</view>
        </view>
        <view class="help-police-item">
          <image src="/static/yyq/police_fire.png" class="help-police-icon" />
          <view class="help-police-label">火警</view>
          <view class="help-police-num">119</view>
        </view>
        <view class="help-police-item">
          <image src="/static/yyq/police_yj.png" class="help-police-icon" />
          <view class="help-police-label">急救中心</view>
          <view class="help-police-num">120</view>
        </view>
        <view class="help-police-item">
          <image src="/static/yyq/police_110.png" class="help-police-icon" />
          <view class="help-police-label">公安报警</view>
          <view class="help-police-num">110</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue';
const tabIndex = ref(2); // 默认拖车
const form = ref({
  start: '',
  end: '',
  name: '',
  phone: '',
  plate: '',
  desc: ''
});
function goBack() {
  uni.navigateBack();
}
function callHelp() {
  uni.showToast({ title: '已呼叫救援', icon: 'success' });
}
</script>

<style scoped lang="scss">
.help-bg {
  min-height: 100vh;
  background: #f5f6fa;
  padding-bottom: 24px;
}
.help-header {
  display: flex;
  align-items: center;
  height: 56px;
  background: #338aff;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  padding: 0 16px;
}
.help-title {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
}
.help-map-card {
  background: #fff;
  border-radius: 12px;
  margin: 16px 16px 0 16px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(51,138,255,0.04);
}
.help-map-img {
  width: 100%;
  height: 120px;
  border-radius: 8px;
}
.help-tabs {
  display: flex;
  margin: 16px 16px 0 16px;
  border-bottom: 2px solid #eee;
}
.help-tab {
  flex: 1;
  text-align: center;
  font-size: 16px;
  color: #888;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
}
.help-tab.active {
  color: #338aff;
  font-weight: bold;
  border-bottom: 2px solid #338aff;
}
.help-form-card {
  background: #fff;
  border-radius: 12px;
  margin: 0 16px 0 16px;
  padding: 16px 12px 8px 12px;
  box-shadow: 0 2px 8px rgba(51,138,255,0.04);
  margin-bottom: 16px;
}
.help-form-row {
  margin-bottom: 12px;
}
.help-input {
  width: 100%;
  height: 36px;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 15px;
  background: #f8f8f8;
}
.help-textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 15px;
  background: #f8f8f8;
}
.help-btn {
  width: 100%;
  margin: 12px 0 0 0;
  padding: 12px 0;
  border-radius: 24px;
  background: linear-gradient(90deg, #ff7d1a 0%, #ff3d1a 100%);
  color: #fff;
  font-size: 18px;
  border: none;
}
.help-tip {
  text-align: center;
  color: #888;
  font-size: 14px;
  margin: 8px 0 0 0;
}
.help-police-card {
  background: #fff;
  border-radius: 12px;
  margin: 0 16px 0 16px;
  padding: 16px 12px 12px 12px;
  box-shadow: 0 2px 8px rgba(51,138,255,0.04);
}
.help-police-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 12px;
  color: #222;
}
.help-police-list {
  display: flex;
  justify-content: space-between;
}
.help-police-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.help-police-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 4px;
}
.help-police-label {
  font-size: 14px;
  color: #333;
  margin-bottom: 2px;
}
.help-police-num {
  font-size: 16px;
  color: #ff7d1a;
  font-weight: bold;
}
</style>
